<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8"
	contentType="text/html;charset=UTF-8"%>
<%@ include file="/includes/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>汽车颜色管理</title>
<meta name="menu" content="carMgr" />
<link rel="stylesheet" type="text/css" href="<c:url value='/styles/tablesorter/style.css'/>" />
<script type="text/javascript" src="<c:url value='/scripts/jquery.tablesorter.js'/>"></script>
</head>
<body>
 
<form id="colorForm" action="" method="post" style="margin: 0px;">
<input id="carid" name="colorId" type="hidden" value=""/>
<table width="100%" cellpadding="4" cellspacing="0" border="0" style="display:none;">
<tr >

    <td>
	上传人姓名:<input type="text" id="susid" name="userId" value= "<c:out value='${userId}'/>" style="width:150px;" />
	</td>
	
	 <td>
	配方状态: <select name="state">
		<option value="1">正常</option>
		<option value="0">不正常</option>
		</select>
	</td>
	
	<td> 
	<input type="button" value="新增颜色配方" onclick="AddData()"/>
	</td>
</tr>
</table> 
	
	
	
<table width="90%" >
	<tr>
			<td  align="right" >
	 		<table>
	 			<tr onclick="AddData();" style="cursor:pointer;" title="新增颜色配方">
	 				<td >
	 					<img  src="<c:url value='/styles/icon/configure.png'/>"/>
	 				</td>
	 				<td style="font-stretch:20;font-weight: 20">
	 				<h3>新增颜色配方</h3>
	 				</td>
	 			</tr>
	 		</table>
	 	
	 		
	 	
	 		</td>
	 	 
	</tr>
</table>


</form>

<table id="tableList" class="tablesorter" cellspacing="1">
	<thead>
		<tr>
			<th>序号</th>
			<th>颜色名称</th>
			<th>配方人</th>
			<th>图片文件名</th>
			<th>图片文件路径</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
	<%int count = 1 ;%>
		<c:forEach var="color" items="${alist}">
			<tr>
			<td align="center" width="20px">
				<%=count %><%count++; %>
				</td>
				
				<td align="center">
				<c:out value="${color.colorName}" />
				</td>
				<td><c:out value="${color.userId}" /></td>
				<td>
					<c:out value="${color.fileName}" />
				</td>
				<td>
					<c:out value="${color.imageLocation}" />
				</td>
				<td><a href="#" onclick='ModifyData(<c:out value="${color.id}" />)'>修改</a></td>
			</tr>
		</c:forEach>
	</tbody>
</table>

<script type="text/javascript">
//<![CDATA[
$(function() {
	$('#tableList').tablesorter();
	//$('#tableList').tablesorter( {sortList: [[0,0], [1,0]]} );
	//$('table tr:nth-child(odd)').addClass('odd');
	$('table tr:nth-child(even)').addClass('even');	 
});
//]]>
function ModifyData(id){
	var frmObj=document.getElementById("colorForm");
	document.getElementById("carid").value=id;
	frmObj.action="carColor.do?action=modify";
	frmObj.submit();	
}
function AddData(){
	var frmObj=document.getElementById("colorForm");
	frmObj.action="carColor.do?action=add";
	frmObj.submit();	
}
</script>

</body>
</html>
